home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / lcppb.zip / LCPP05.ZIP / ELEVATOR.H < prev    next >
C/C++ Source or Header  |  1991-07-04  |  1KB  |  48 lines

  1. // elevator.h -- Header file for elevator.cpp
  2.  
  3. #ifndef __ELEVATOR_H
  4. #define __ELEVATOR_H    1     // Prevent multiple #includes
  5.  
  6. #include "elevsim.h"
  7. #include "floor.h"
  8. #include "person.h"
  9.  
  10. class elevator {
  11.   private:
  12.     int elevNumber;         // Elevator's number
  13.     int timeToAction;       // Time in secs until next action
  14.     int floorNumber;        // Current floor number
  15.     int stopped;            // 1 == stopped at floor
  16.     int direction;          // 1 == up, -1 == down, 0 == none
  17.     int buttons[MAXFLOORS]; // Flr buttons (0 == off, 1 == on)
  18.     int passengers;         // Number of passengers on board
  19.     int buttonUp(void);
  20.     int buttonDown(void);
  21.   public:
  22.     elevator();
  23.     int getPassengers(void) { return passengers; }
  24.     void setelevNumber(int n);
  25.     void showElevator(void);
  26.     void setDirection(floorCollection &theFloors);
  27.     int elevStopping(floorCollection &theFloors);
  28.     void action(floorCollection &theFloors, 
  29.         persCollection &thePersons);
  30. };
  31.  
  32. class elevCollection {
  33.   private:
  34.     elevator ea[MAXELEVS];  // Array of elevator objects
  35.   public:
  36.     elevCollection();
  37.     void showElevators(void);
  38.     void action(floorCollection &theFloors, 
  39.         persCollection &thePersons);
  40.     int avgRiding(void);
  41. };
  42.  
  43. #endif   // __ELEVATOR_H
  44.  
  45.  
  46. // Copyright (c) 1990 by Tom Swan. All rights reserved
  47. // Revision 1.00    Date: 09/18/1990   Time: 09:11 am
  48.